import Core from '@/core.js'
export default {
  data() {
    return {
      Core,
      role: '',
      list: [],
      total: 0,
      cardStyle: {
        工商银行: {
          bg: 'background:linear-gradient(-90deg, #FE7265, #FE5662)',
          src: '1.1',
        },
        农业银行: {
          bg: 'background:linear-gradient(-90deg, #129B65, #15B677)',
          src: '2.1',
        },
        中国银行: {
          bg: 'background:linear-gradient(-90deg, #FE7265, #FE5662)',
          src: '3.1',
        },
        邮政银行: {
          bg: 'background:linear-gradient(-90deg, #01B3A2, #038DAB)',
          src: '4.1',
        },
        兴业银行: {
          bg: 'background:linear-gradient(-90deg, #2D8DD7, #2D66D0)',
          src: '5.1',
        },
        招商银行: {
          bg: 'background:linear-gradient(-90deg, #FE7265, #FE5662)',
          src: '6.1',
        },
        广发银行: {
          bg: 'background:linear-gradient(-90deg, #FE7265, #FE5662)',
          src: '7.1',
        },
        成都银行: {
          bg: 'background:linear-gradient(-90deg, #FFC37A, #FF9326)',
          src: '8.1',
        },
        中国建设银行: {
          bg: 'background:linear-gradient(-90deg, #2D8DD7, #2D66D0)',
          src: '9.1',
        },
      },
    }
  },
  onLoad() {
    this.role = uni.getStorageSync('Ztc_B_USER_INFO').role
  },
  onShow() {
    this.getBankCardList()

  },
  methods: {
    getStryle(name) {
      if (this.cardStyle[name]) {
        return this.cardStyle[name].bg
      }
      return 'background: linear-gradient(-90deg, #C7C7C7, #7F7F7F);'
    },

    getBgimg(name) {
      if (this.cardStyle[name]) {
        return `/static/img/user/${this.cardStyle[name].src}.png `
      }
      return ''
    },

    getBankCardList() {
      this.$api.user
        .getBankCardList({
          pageIndex: 1,
          pageSize: 100,
        })
        .then(res => {
          if (res.data.total !== 0) {
            this.list = res.data.list
            this.total = res.data.total
            if(this.total===0){

            }
          }
        })
        .catch(e => {
          console.log(e)
        })
    },

    //添加账户
    addAccount() {
      uni.navigateTo({
        url: '/pages_common/pages_me/assets/addAccount/addAccount',
      })
    },

  },
}
